package com.citycloud.ccuap.tc.admin.role;

import com.citycloud.ccuap.commons.db.SqlRestrictions;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import java.util.Map;

/**
 * @author liujw
 * @create 2019-06-28 11:36
 * Description:
 */
@Mapper
public interface RoleApiMapper {


    @SelectProvider(type = RepositoryProvider.class, method = "findRoleNameByUserId")
    List<Map<String, Object>> findRoleNameByUserId(Long paramLong);


    public static class  RepositoryProvider{
        public String findRoleNameByUserId(Long userId) {
            String sql = " SELECT role.role_name FROM sys_role role inner join sys_act act on role.role_id=act.role_id where 1=1 ";
            return String.valueOf(sql) + SqlRestrictions.eq("act.user_id", userId);
        }
    }
}
